﻿using MediatR;
using StoreISet.Applicationes.Command;
using StoreRepositorys.Interface;

namespace StoreISet.Applicationes.CommandHandler
{
    /// <summary>
    /// 分类相册删除
    /// </summary>
    public class SystematicDeleteCommandler : IRequestHandler<SystematicDeleteCommand, int>
    {
        public readonly ISystematicRepository _systematicRepository;
        public SystematicDeleteCommandler(ISystematicRepository systematicRepository)
        {
            _systematicRepository = systematicRepository;
        }
        public async Task<int> Handle(SystematicDeleteCommand request, CancellationToken cancellationToken)
        {
            try
            {
                return await _systematicRepository.Deleteasync(request.SystematicId);
            }
            catch (Exception)
            {

                throw;
            }
            
        }
    }
}
